package main

import (
	"fmt"
	"time"
)

// 速率限制
// https://gobyexample-cn.github.io/rate-limiting

func main() {
	requests := make(chan int, 5)
	for i := 1; i < 5; i++ {
		requests <- i
	}
	close(requests)

	limiter := time.Tick(200 * time.Millisecond)

	for req := range requests {
		<-limiter
		fmt.Println("请求", req, time.Now())
	}

	burstryLimiter := make(chan time.Time, 3)

}
